<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="db.TobDAO"%>
<%@page import="db.Tob"%>
<%@page import="db.TeamDAO"%>
<%@ include file="/jsp/common/utility/logined.jsp" %>
<%
	WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
	TobDAO tobDao = (TobDAO)ctx.getBean("TobDAO");
	TeamDAO teamDao = (TeamDAO)ctx.getBean("TeamDAO");
	UserDAO userDao = (UserDAO)ctx.getBean("UserDAO");
	
	int tid = (Integer)session.getAttribute("tid");
	int uid = (Integer)session.getAttribute("id");
	
	User user = userDao.findById(uid);
	request.setAttribute("user",user);
	
	request.setAttribute("users",userDao.findAll());
	
	List tobs = tobDao.findAll();
	for(int i=0;i<tobs.size();i++){
		Tob tob = (Tob)tobs.get(i);
		if("借库".equals(tob.getName())){
			request.setAttribute("tob",tob);
			break;
		}
	}
	
	request.setAttribute("team",teamDao.findById(tid));

	pageContext.forward("/vm/borrowStock/borrowApp.vm");
%>
